package top.honlnk.czuan.mapper.update;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UpdateWordRelationMapper {


    @Update("update words set roots_id_list = JSON_ARRAY_APPEND(roots_id_list, '$', #{rootId}), roots_translations_id_list = #{rTIds}, update_by = #{updateUser} WHERE id = #{wordId}")
    void updateRootRelation(Integer wordId, Integer rootId, String rTIds, String updateUser);

    @Update("update words set prefixes_id_list = JSON_ARRAY_APPEND(prefixes_id_list,'$', #{prefixId}), prefixes_translations_id_list = #{pTIds}, update_by = #{updateUser} where id = #{wordId})")
    void updatePrefixRelation(Integer wordId, Integer prefixId, String pTIds, String updateUser);

    @Update("update words set suffixes_id_list = JSON_ARRAY_APPEND(suffixes_id_list,'$', #{suffixId}), suffixes_translations_id_list = #{sTIds}, update_by = #{updateUser} where id = #{wordId})")
    void updateSuffixRelation(Integer wordId, Integer suffixId, String stIds, String updateUser);

    @Update("update words set translations_id_list = #{tIds}, update_by = #{updateUser} where id = #{wordId})")
    void updateTranslationRelation(Integer wordId, String tIds, String updateUser);
}